
package com.market.web.action;

import java.util.List;

import com.market.bean.Msgboard;
import com.market.constant.Constant;
import com.market.web.form.MsgBoardForm;
import com.market.web.tag.Pages;
import com.market.web.utils.ListUtils;

public class MsgBSearchAction extends BaseAction2
{
    public String execute() throws Exception
    {
        int curP = (int)getLong("page");
        if (curP == 0)
        {
            curP++;
        }
        int count = getMsgBoardService().getMsgCount();
        List msg = getMsgBoardService().findMsg((curP - 1) * Constant.perPageMsg, Constant.perPageMsg);
        Pages pages = new Pages();
        pages.setCurPage(curP);
        pages.setPath(getRequest().getServletPath() + ".do?");
        pages.setPerPage(Constant.perPageMsg);
        pages.setRowCount(count);
        getRequest().setAttribute("msgList", ListUtils.convert(msg, Msgboard.class, MsgBoardForm.class));
        getRequest().setAttribute("pages", pages);
        return SUCCESS;
        //return mapping.findForward("msgBoard");
    }
}
